[core] Use automatic build tree detection for all resource directories#21018
[core] Use automatic build tree detection for all resource directories#21018guitargeek wants to merge 3 commits into
Conversation
82f684f to
5bd24d2
Compare
5bd24d2 to
99e0747
Compare
Test Results 21 files 21 suites 3d 20h 48m 28s ⏱️ For more details on these failures, see this check. Results for commit 6dde01e. ♻️ This comment has been updated with latest results. |
9658e4c to
e3a4c50
Compare
301f1a6 to
0c6fb13
Compare
|
https://github.com/root-project/root/actions/runs/21481040637/job/61888781030?pr=21018#step:7:18 This error probably means that ROOT cannot even start and the process segfaults. |
0c6fb13 to
493acb4
Compare
c447a98 to
70e57d8
Compare
This is fixed by that PR: |
70e57d8 to
017f67b
Compare
84ea7d7 to
160e5f1
Compare
000a6bd to
180ebb0
Compare
489b683 to
6c6dee9
Compare
This is to test that ROOT doesn't get confused at build and test time by the fact that the structure of the install tree and build tree is different, which is the case for `gnuinstall=ON`.
|
Updating master merge/rebase point |
| @@ -1,15 +1,14 @@ | |||
| /* This file is automatically generated */ | |||
There was a problem hiding this comment.
I changed this file manually, so arguably the file is not automatically generated anymore. Also how did this comment help without saying how the file was automatically generated? 🙂
There was a problem hiding this comment.
The comment is one off in this context :). The file compiledata.win32.in is hand written but used as a template for the generation of compiledata.h and in the that file the comment is accurate :)
There was a problem hiding this comment.
Oh okay I get what you mean now! I'll add the comment back
| endif() | ||
| file(RELATIVE_PATH install_lib_to_include "${libdir}" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") | ||
| unset(libdir) | ||
| file(RELATIVE_PATH _rel "${libdir}" "${install_dir_absolute}") |
There was a problem hiding this comment.
What happens if libdir and install_dir_absolute are both absolute and unrelated (weird installation where one of the directory is being installed in an unusual place).
There was a problem hiding this comment.
To keeps things simple and branch-free: every resource directory is encoded as a path relative to libdir, resolved at runtime against the actual location of libCore. So the whole install tree stays relocatable as long as its internal layout is preserved.
There might be corner cases where different behavior is preferable, e.g. an some absolute resource directory like /usr/etc directory outside the install prefix that you expect to stay fixed even when the build is relocated. There, a relative path would be wrong. But I think that's a pathological case we Shouldn't support unless a user actually asks for it.
To be fair, this would have worked before with gnuinstall=ON, because all resource directories were absolute in that case, but that also means gnuinstall=ON builds weren't relocatable. One of my goals here was to unify the gnuinstall=ON and gnuinstall=OFF behavior so they only differ by the CMAKE_INSTALL_<…> paths. So if you want relocatable builds and not too many if-else branches in the CMake, what's in the PR is the result..
There was a problem hiding this comment.
We really do not have a good handle on whether the feature is or is not used (I do have some recollection of using stashing the etc and/or share directory 'somewhere' else). Unless I can re-find the user I am thinking of (and maybe even if), we really should "explicitly" error out if we can detect the issue.
16434df to
e697135
Compare
This follows up on a5b1ed9, using the mechanism to automatically detect if we are in the build tree or install tree also for the other resource directories (so far it was only implemented for the `include` directory as a first test). Several fallbacks and hacks can be removed because of this change, like the `ROOTIGNOREPREFIX` variable that was needed to run ROOT in the build tree for the tests.
Example of how the warning looks like if it happens: ```txt [I] omen nix-shell ~/c/r/root_build > ROOTSYS=/home/rembserj/ ./bin/root Warning in <TROOT>: ROOTSYS is set but inconsistent with detected ROOT installation: ROOTSYS=/home/rembserj/ Detected=/home/rembserj/code/root/root_build ROOT will use the detected installation. ------------------------------------------------------------------ | Welcome to ROOT 6.41.01 https://root.cern | | (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers | | Built for linuxx8664gcc on Jan 01 1980, 00:00:00 | | From heads/ignoreprefix@v6-99-99-368-gd1d33ba04be | | With clang version 21.1.8 std202002 | | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' | ------------------------------------------------------------------ root [0] ```
This follows up on a5b1ed9, using the mechanism to automatically detect if we are in the build tree or install tree also for the other resource directories (so far it was only implemented for the
includedirectory as a first test).Several fallbacks and hacks can be removed because of this change, like the
ROOTIGNOREPREFIXvariable that was needed to run ROOT in the build tree for the tests.This change also makes ROOT completely independent of the
ROOTSYSenvironment variable and therefore unblocks #20006.If one wants to check that all the resource directories (inlcuding RootSys()) are correct, one can use this check: